//import { saveAs } from 'file-saver'
import axios from 'axios'

import common from '@/api/api';
//const baseURL = process.env.VUE_APP_BASE_API
const baseURL = common.apihost;

export default {
  name(name, isDelete = true) {
    console.log(123123);
   // var url = baseURL + "/common/download?fileName=" + encodeURI(name) + "&delete=" + isDelete
   // axios({
   //   method: 'get',
   //   url: url,
   //   responseType: 'blob',

   // }).then(res => {
   //   const blob = new Blob([res.data])
   //   this.saveAs(blob, decodeURI(res.headers['download-filename']))
   // })

   var iframe =document.createElement("iframe");
   iframe.style.display ="none";
   let urls = common.apihost+'/common/download?fileName='+name+'&delete='+isDelete;
   console.log(urls)
   iframe.src = urls;
   document.body.appendChild(iframe);
  }
}
